package com.cookor.poi.modules.phy.mobile;

import com.cookor.poi.common.utils.ResultUtil;
import com.cookor.poi.modules.tenant.entity.TTenant;
import com.cookor.poi.modules.tenant.service.TTenantService;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping({"/api/phy/tenant"})
@ResponseBody
public class ApiTenantController extends ApiBaseController {
  @Autowired
  private TTenantService tTenantService;
  
  @RequestMapping({"/list"})
  public ResultUtil tenantList(HttpServletRequest request) {
    ResultUtil result = getResult();
    try {
      TTenant tenant = new TTenant();
      tenant.setDelFlag("0");
      List<TTenant> list = this.tTenantService.findList(tenant);
      result.putParams("list", list);
    } catch (Exception e) {
      result.setCode(ResultUtil.ERROR_CODE);
      result.setError(e.getMessage());
      this.logger.error("ApiTenantController list error!", e);
    } 
    return result;
  }
}
